import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Scanner;
import java.io.PrintWriter;

public class task4 {

	public static void main(String[] args) throws FileNotFoundException {
		
		double avg , total=0 , score;
		int counter=0 ,ID;
		
		FileInputStream input1 = new FileInputStream("input4.txt");
				
		Scanner sc = new Scanner(input1);
		
		do {
		ID = sc.nextInt();
		score = sc.nextDouble();
		
		total = total + score;
		counter++;
		
		}while(sc.hasNext());
		
		avg = total / counter;
		
		FileInputStream input2 = new FileInputStream("input4.txt");
		Scanner sc2 = new Scanner(input2);
		
		FileOutputStream output1 = new FileOutputStream("output good.txt");
		FileOutputStream output2 = new FileOutputStream("output poor.txt");
		
		PrintWriter pw1 = new PrintWriter(output1);
		PrintWriter pw2 = new PrintWriter(output2);
		
		pw1.printf("ID\tScore%n");
		pw2.printf("ID\tScore%n");
		
		do {
			ID = sc2.nextInt();
			score = sc2.nextDouble();
			
			if(score >= avg)
				pw1.printf("%d\t%.2f%n",ID,score);
			else
				pw2.printf("%d\t%.2f%n",ID,score);
			
			}while(sc2.hasNext());
		
		pw1.close();
		pw2.close();
		sc.close();
		sc2.close();
		
	}

}
